import 'package:casdon/app/config/theme/theme_extention.dart';
import 'package:flutter/material.dart';

class InfoNotificationBar extends StatelessWidget {
  final String message;
   final Widget? rightButton;
  final VoidCallback? onClose;
  
  const InfoNotificationBar({
    super.key,
    required this.message,
    this.rightButton,
    this.onClose,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
      decoration: BoxDecoration(
        color: Color(0xFFF2F3FF),
      ),
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: [
          // 紫色信息图标
          Container(
            width: 24,
            height: 24,
            decoration: BoxDecoration(
              color: context.colorScheme.primary , // 紫色
              shape: BoxShape.circle,
            ),
            child: const Center(
              child: Text(
                'i',
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 16,
                  fontWeight: FontWeight.bold,
                ),
              ),
            ),
          ),
          
          const SizedBox(width: 12),
          
          // 消息文本
          Expanded(
            child: Text(
              message,
              style: const TextStyle(
                fontSize: 14,
                color: Colors.black,
              ),
            ),
          ),
          
          // 可选关闭按钮
          if (onClose != null) ...[
            const SizedBox(width: 8),
            GestureDetector(
              onTap: onClose,
              child: const Icon(Icons.close, size: 18, color: Colors.grey),
            ),
          ],
          if(rightButton != null && onClose == null) ...[
            const SizedBox(width: 8),
             rightButton!,
          ]

        ],
      ),
    );
  }
}